package com.xiaoluo.lottery.entity;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by Caedmon on 2016/4/5.
 */
public class Round {

    /**唯一ID*/
    private long id;
    /**游戏名称*/
    private String name;
    /**物品ID*/
    private long itemId;
    /**发起人的Id*/
    private String createPlayerOpenId;
    /**创建时间*/
    private Date createAt;
    /**类型 0 默认*/
    private int gameType;
    /**单个人/单张票金额*/
    private double singleAmount;
    /**需要满足人数*/
    private int num;
    /**中奖人OpenId*/
    private String winnerOpenId;
    /**中奖号码*/
    private String winnerNo;
    /**开奖时间*/
    private Date lotteryTime;
    /**过期时间*/
    private Date expiredTime;
    /**当前状态*/
    private int status;
    /**发奖时间*/
    private Date awardTime;
    /**发奖失败原因*/
    private String awardFailReason;
    /**参与玩家列表*/
    private List<PlayRecord> records=new ArrayList<>();
    /**当前已参与人次*/
    private int remainNum;
    public static final int TYPE_CREATE_BY_PLAYER=0;
    public static final int STATUS_INIT=0;//初始化状态
    public static final int STATUS_RUNNING=1;//进行中,创建成功
    public static final int STATUS_END=2;//正常结束
    public static final int STATUS_END_FAIL=3;//不正常结束
    public static final int STATUS_WAIT_AWARD=4;//等待发奖
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public Date getCreateAt() {
        return createAt;
    }

    public void setCreateAt(Date createAt) {
        this.createAt = createAt;
    }

    public int getGameType() {
        return gameType;
    }

    public void setGameType(int gameType) {
        this.gameType = gameType;
    }

    public double getSingleAmount() {
        return singleAmount;
    }

    public void setSingleAmount(double singleAmount) {
        this.singleAmount = singleAmount;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public String getWinnerOpenId() {
        return winnerOpenId;
    }

    public void setWinnerOpenId(String winnerOpenId) {
        this.winnerOpenId = winnerOpenId;
    }

    public Date getLotteryTime() {
        return lotteryTime;
    }

    public void setLotteryTime(Date lotteryTime) {
        this.lotteryTime = lotteryTime;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public List<PlayRecord> getRecords() {
        return records;
    }

    public void setRecords(List<PlayRecord> records) {
        this.records = records;
    }

    public String getCreatePlayerOpenId() {
        return createPlayerOpenId;
    }

    public void setCreatePlayerOpenId(String createPlayerOpenId) {
        this.createPlayerOpenId = createPlayerOpenId;
    }

    public Date getExpiredTime() {
        return expiredTime;
    }

    public void setExpiredTime(Date expiredTime) {
        this.expiredTime = expiredTime;
    }

    public Date getAwardTime() {
        return awardTime;
    }

    public void setAwardTime(Date awardTime) {
        this.awardTime = awardTime;
    }

    public String getAwardFailReason() {
        return awardFailReason;
    }

    public void setAwardFailReason(String awardFailReason) {
        this.awardFailReason = awardFailReason;
    }

    public String getWinnerNo() {
        return winnerNo;
    }

    public void setWinnerNo(String winnerNo) {
        this.winnerNo = winnerNo;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public long getItemId() {
        return itemId;
    }

    public void setItemId(long itemId) {
        this.itemId = itemId;
    }

    public int getRemainNum() {
        return remainNum;
    }

    public void setRemainNum(int remainNum) {
        this.remainNum = remainNum;
    }

    public double getTotalAmount(){
        return new BigDecimal(singleAmount).multiply(new BigDecimal(num)).doubleValue();
    }
    public int incrRemainNum(int num){
        this.remainNum=this.remainNum+num;
        return this.remainNum;
    }
    public int decrRemainNum(int num){
        this.remainNum=this.remainNum-num;
        return this.remainNum;
    }
}
